function S = z2S(z,m)

N = length(z);
n = N/m;

Z = reshape(z, m, n);
[~, idx] = max(Z);

S = zeros(2*n,2);
for i = 1:n
    theta = 2*pi*idx(i)/m;
    S(2*i-1:2*i, :) = [cos(theta), -sin(theta); sin(theta), cos(theta) ];
end